﻿#region Name
using System;
    using System.Collections.Generic;
    using System.Linq;
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Audio;
    using Microsoft.Xna.Framework.Content;
    using Microsoft.Xna.Framework.GamerServices;
    using Microsoft.Xna.Framework.Graphics;
    using Microsoft.Xna.Framework.Input;
    using Microsoft.Xna.Framework.Media;

#endregion
/// <summary>
/// Summary description for Class1
/// </summary>
public class Menu : GUI
{
    Texture2D background;
    Button[] buttons;
    int selected;//what button is highlighted

	public Menu(Texture2D background, Button[] buttons, Game game):base(game)
	{
        spriteBatch = new SpriteBatch(game.GraphicsDevice);
        this.background = background;
        this.buttons = buttons;
	}

    //accessor/mutator methods
    public Texture2D getBackground() { return background; }
    public Button[] getButtons() { return buttons; }
    public void setButtons(Button[] newButtons) { buttons = newButtons; }
    public int getSelected() { return selected; }
    public void setSelected(int newSelected) { selected=newSelected; }

    public Game.State updateSelected(KeyboardState keyState)
    {
        if (keyState.IsKeyDown(Keys.Up))
        {
            selected--;
            if (selected < 0)
                selected = 0;
            return Game.State.Menu;
        }
        else if (keyState.IsKeyDown(Keys.Down))
        {
            selected++;
            if (selected >= buttons.Length)
                selected = buttons.Length - 1;
            return Game.State.Menu;
        }
        else if (keyState.IsKeyDown(Keys.Enter) && selected == 0)
        {
            return Game.State.InGame;
        }
        else
        {
            return Game.State.Menu;
        }
    }

    protected void LoadContent(String filename)
    {
        // Create a new SpriteBatch, which can be used to draw textures.
        


        // TODO: use this.Content to load your game content here
    }
    protected void UnloadContent()
    {
        // TODO: Unload any non ContentManager content here
    }
    

}
